~ chicken-core (master) /manual/Module (scheme load)
Trap1[[tags: manual]]2[[toc:]]34== Module (scheme load)56<procedure>(load filename [environment-specifier])</procedure>78It is an error if filename is not a string.910The load procedure reads expressions and definitions from the file designated11by filename and evaluates12them sequentially in the environment specified by13environment-specifier. If14environment-specifier is omitted, (interaction-environment) is assumed.1516The load procedure does not affect the values returned by current-input-port and17current-output-port. It returns an unspecified value.1819CHICKEN offers a few extensions to the R7RS definition of {{load}}:2021* The environment specifier may also be a procedure of a single argument taking a expression and is used to evaluate every toplevel expression read from the input file, if the file contains Scheme source code.2223* On platforms that support it (currently BSD, Haiku, MacOS X, Linux, Solaris, and Windows), {{load}} can be used to load shared objects.2425Example for loading compiled programs:2627 % cat x.scm28 (define (hello) (print "Hello!"))29 % csc -s x.scm30 % csi -q31 #;1> (load "x.so")32 ; loading x.so ...33 #;2> (hello)34 Hello!35 #;3>3637There are some limitations and caveats to the CHICKEN extensions you38need to be aware of:3940* The second argument to {{load}} is ignored when loading compiled code.41* A compiled file can only be loaded once. Subsequent attempts to load the same file have no effect.4243---44Previous: [[Module (scheme lazy)]]4546Next: [[Module (scheme process-context)]]